package com.xwolf.rmi;

import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.remoting.rmi.RmiProxyFactoryBean;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * @author ming
 * @Description:
 * @create 2019-01-26 9:05 PM
 **/
@Service
@Log4j
public class RmiClient {
    @Autowired
    public RmiProxyFactoryBean rmiProxyFactoryBean;

    @PostConstruct
    public void invokeRmi(){
        RMIExService rmiExService = (RMIExService)rmiProxyFactoryBean.getObject();
        String result = rmiExService.invokingRemoteService();
        log.info("result is" + result);
    }
}
